package com.woman.beautylive.data.repository;

import com.woman.beautylive.data.bean.AnchoBean;
import com.woman.beautylive.data.bean.AnchorSummary;
import com.woman.beautylive.data.bean.BaseResponse;
import com.woman.beautylive.data.bean.CurrencyRankItem;
import com.woman.beautylive.data.bean.GetFriendBean;
import com.woman.beautylive.data.bean.HotAnchorPageBean;
import com.woman.beautylive.data.bean.HotAnchorSummary;
import com.woman.beautylive.data.bean.IncomeBean;
import com.woman.beautylive.data.bean.LoginInfo;
import com.woman.beautylive.data.bean.PageBean;
import com.woman.beautylive.data.bean.PushStreamInfo;
import com.woman.beautylive.data.bean.ThemBean;
import com.woman.beautylive.data.bean.gift.Gift;
import com.woman.beautylive.data.bean.me.PlayBackInfo;
import com.woman.beautylive.data.bean.me.UserInfo;
import com.woman.beautylive.data.bean.room.HitList;
import com.woman.beautylive.data.bean.room.LiveRoomEndInfo;
import com.woman.beautylive.data.bean.room.PrvMsg;
import com.woman.beautylive.data.bean.room.RoomAdminInfo;
import com.woman.beautylive.data.bean.transaction.PresentRecordItem;
import com.woman.beautylive.data.bean.transaction.RechargeInfo;
import com.woman.beautylive.data.bean.transaction.WithDrawRespose;
import com.woman.beautylive.presentation.ui.main.find.paihangbangbean.DongTaiDetailBean;
import com.woman.beautylive.presentation.ui.main.find.paihangbangbean.DongTaiListBean;
import com.woman.beautylive.presentation.ui.main.find.paihangbangbean.MeiLiBangBean;
import com.woman.beautylive.presentation.ui.main.find.paihangbangbean.MyDongTaiBean;
import com.woman.beautylive.presentation.ui.main.find.pengyouquan.PublishBean;

import java.util.List;

import okhttp3.MultipartBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import rx.Observable;

/**
 * 定义Retrofit请求的method/param等。
 * Created by huanzhang on 2016/4/11.
 */
interface RetrofitApi {

    @POST("user/register")
    Observable<BaseResponse<LoginInfo>> register(@Query("username") String username,
                                                 @Query("password") String password);

    @POST("user/autoLogin")
    Observable<BaseResponse<LoginInfo>> autoLogin(@Query("token") String token);

    @POST("user/login")
    Observable<BaseResponse<LoginInfo>> login(@Query("username") String username,
                                              @Query("password") String password);

    @GET("anchor/search")
    Observable<BaseResponse<PageBean<AnchorSummary>>> queryAnchors
            (@Query("query") String condition,
             @Query(QueryConstants.PAGE_NUM) int pageNum);

    @GET("anchor/onlineFriends")
    Observable<BaseResponse<List<HotAnchorSummary>>> loadFollowedLives(@Query(QueryConstants.PAGE_NUM) int pageNum);

    @GET("Topic/getTopicUser")
    Observable<BaseResponse<List<HotAnchorSummary>>> loadTopicLives(@Query("topicId") int topicID);

    @GET("anchor/hot")
    Observable<BaseResponse<HotAnchorPageBean>> meiLiBang(@Query(QueryConstants.PAGE_NUM) int pageNum);

    @GET("Anchor/getAnchorListTest")
    Observable<BaseResponse<HotAnchorPageBean>> meiLiBang(@Query("token") String token,
                                                          @Query("province") String province,
                                                          @Query("sex") String sex);


    @GET("anchor/recommend")
    Observable<BaseResponse<PageBean<AnchorSummary>>> loadRecommendAnchors(@Query("token") String token,
                                                                           @Query("order") String time);

    @GET("anchor/city")
    Observable<BaseResponse<PageBean<AnchorSummary>>> loadCommendAnchors(@Query("token") String token,
                                                                         @Query("city") String city);

    @GET("user/follow")
    Observable<BaseResponse<Object>> followAnchor(@Query("uid") String uid);

    @GET("user/unfollow")
    Observable<BaseResponse<Object>> unfollowAnchor(@Query("uid") String uid);

    @GET("user/profile")
    Observable<BaseResponse<UserInfo>> getUserInfo(@Query("uid") Integer uid);

    @GET("User/setEmotion")
    Observable<BaseResponse<String>> getEmotion(@Query("token") String token,
                                                @Query("emotion") int emotion);

    @GET("User/setBirthday")
    Observable<BaseResponse<String>> setBirthday(@Query("token") String token,
                                                 @Query("birthday") String birthday);

    @GET("User/setProvince")
    Observable<BaseResponse<String>> getProvince(@Query("token") String token,
                                                 @Query("province") String province,
                                                 @Query("city") String city);

    @GET("Anchor/getAnchorBean")
    Observable<BaseResponse<AnchoBean>> getAnchoBean(@Query("user_id") String user_id);

    @GET("user/follow")
    Observable<BaseResponse<String>> starUser(@Query("token") String token,
                                              @Query("uid") String uid,
                                              @Query("roomid") String roomid);

    @GET("user/unfollow")
    Observable<BaseResponse<String>> unStarUser(@Query("token") String token,
                                                @Query("uid") String uid,
                                                @Query("roomid") String roomid);

    @GET("user/followees")
    Observable<BaseResponse<PageBean<AnchorSummary>>> getUserStars(@Query("uid") String uid,
                                                                   @Query(QueryConstants.PAGE_NUM) int pageNum);

    @GET("user/followers")
    Observable<BaseResponse<PageBean<AnchorSummary>>> getUserFans(@Query("uid") String uid,
                                                                  @Query(QueryConstants.PAGE_NUM) int pageNum);

    @GET("gift/collection")
    Observable<BaseResponse<List<Gift>>> getAvailableGifts();

    @POST("gift/send")
    Observable<BaseResponse<Object>> sendGift(@Query("to_uid") String toUserId,
                                              @Query("gift_id") String giftId,
                                              @Query("count") int count);

    @POST("Gift/sendredgift")
    Observable<BaseResponse<Object>> sendHongBaoGift(@Query("token") String token,
                                                     @Query("to_uid") String roomuid,
                                                     @Query("gift_id") String giftid);

    @POST("user/edit")
    Observable<BaseResponse<String>> editProfile(@Query("profile") String profileJson);

    @POST("User/setProfessional")
    Observable<BaseResponse<String>> editJob(@Query("token") String token,
                                             @Query("professional") String professional);

    @POST("anchor/live")
    Observable<BaseResponse<Object>> setLiveStatus(@Query("token") String token,
                                                   @Query("status") String status);

    @GET("room/entryOfflineroom")
    Observable<BaseResponse<LiveRoomEndInfo>> getLiveRoomInfo(@Query("roomnum") String roomId);

    @GET("user/getchargeoption")
    Observable<BaseResponse<RechargeInfo>> getRechargeInfo();

    @POST("user/location")
    Observable<BaseResponse<Object>> reportLocation(@Query("lat") String lat, @Query("lng") String
            lng);

    @GET("user/contributeList")
    Observable<BaseResponse<PageBean<CurrencyRankItem>>> getCurrencyRankList(@Query("user_id") String uid,
                                                                             @Query(QueryConstants.PAGE_NUM) int pageNum);

    @POST("user/uploadavatar")
    @Multipart
    Observable<BaseResponse<String>> uploadAvatar(@Part MultipartBody.Part file);

    @GET("user/income")
    Observable<BaseResponse<IncomeBean>> getIncomeBean();

    @POST("user/incometocash")
    Observable<BaseResponse<WithDrawRespose>> withDraw(@Query("num") String num,
                                                       @Query("account") String account);

    @GET("User/cashhistory/")
    Observable<BaseResponse<List<PresentRecordItem>>> getPresentRecord();

    @POST("auth/login")
    Observable<BaseResponse<LoginInfo>> thirdLogin(@Query("openid") String openId,
                                                   @Query("type") String platform,
                                                   @Query("payload") String extras);

    @POST("payment/aliPay")
    Observable<BaseResponse<String>> generateRechargeOrder(@Query("num") String account);

    @GET("qiniu/getPushAddress")
    Observable<BaseResponse<PushStreamInfo>> generatePushStreaming(@Query("roomID") String roomId);

    @GET("qiniu/getPullAddress")
    Observable<BaseResponse<String>> getPlaybackUrl(@Query("roomID") String roomId);

    @POST("SMS/sendSMS")
    Observable<BaseResponse<String>> sendCaptcha(@Query("phone") String phone);

    @POST("SMS/verify")
    @FormUrlEncoded
    Observable<BaseResponse<LoginInfo>> loginByCaptcha(@Field("phone") String phone,
                                                       @Field("captcha") String captcha);

    @POST("Room/getAdmin")
    Observable<BaseResponse<List<RoomAdminInfo>>> getAdmin(@Query("token") String token,
                                                           @Query("uid") String uid);

    @POST("room/delAdmin")
    Observable<BaseResponse<Object>> removeAdmin(@Query("token") String token,
                                                 @Query("uid") String uid,
                                                 @Query("adminuid") String adminid);

    @GET("Room/getRoomBack")
    Observable<BaseResponse<List<PlayBackInfo>>> getPlayBack(@Query("token") String token,
                                                             @Query("roomid") String roomid);

    @GET("Qiniu/getPlayback")
    Observable<BaseResponse<String>> getPlayBackListUrl(@Query("roomID") String roomID,
                                                        @Query("startTime") String start,
                                                        @Query("endTime") String end);

    @POST("Topic/getTopic")
    Observable<BaseResponse<ThemBean>> getThemBean();

    @POST("Topic/getTopic")
    Observable<BaseResponse<ThemBean>> getThemBean(@Query("title") String title,
                                                   @Query("count") String number);

    @GET("room/createRoom")
    Observable<BaseResponse<Object>> postCreateRoom(@Query("token") String token,
                                                    @Query("title") String title,
                                                    @Query("roomid") String roomid,
                                                    @Query("address") String address,
                                                    @Query("province") String province);

    @GET("Message/sendMsg")
    Observable<BaseResponse<PrvMsg>> chat(@Query("token") String token,
                                          @Query("to_uid") String to_uid,
                                          @Query("content") String content);

    @GET("User/getHitlist")
    Observable<BaseResponse<List<HitList>>> hitList(@Query("token") String token);

    @GET("User/setHit")
    Observable<BaseResponse<Object>> setHit(@Query("token") String token,
                                            @Query("hituid") String title);

    @GET("User/removeHit")
    Observable<BaseResponse<Object>> removeHit(@Query("token") String token,
                                               @Query("hituid") String title);

    @GET("Friend/getfriend")
    Observable<BaseResponse<List<GetFriendBean>>> getFriendList();

    @GET("rank/glamourMonth")
    Observable<BaseResponse<List<MeiLiBangBean>>> meiLiBang();//魅力排行榜

    @GET("rank/richMonth")
    Observable<BaseResponse<List<MeiLiBangBean>>> fuHaoBang();//富豪排行榜

    @POST("pengyou/publish")
    Observable<BaseResponse<PublishBean>> publicsh(@Query("token") String token, @Query("content") String content, @Query("pics") String pics);//发布动态

    @POST("pengyou/edit")
    Observable<BaseResponse<String>> updatePublish(@Query("token") String token, @Query("pid") String pid, @Query("content") String content, @Query("pics") String pics);//修改动态

    @POST("pengyou/delete")
    Observable<BaseResponse<String>> deletePublish(@Query("token") String token, @Query("pid") String pid);

    @POST("pengyou/reply")
    Observable<BaseResponse<PublishBean>> replyOne(@Query("token")String token, @Query("pid")String pid, @Query("content")String content);

    @POST("pengyou/like")
    Observable<BaseResponse<String>> dianzan(@Query("token")String token, @Query("pid")String pid, @Query("islike")String islike);
    @POST("pengyou/replyReply")
    Observable<BaseResponse<PublishBean>> replyTwo(@Query("token")String token, @Query("rid")String rid, @Query("content")String content);
    @POST("pengyou/dongtai")
    Observable<BaseResponse<DongTaiListBean>> dongTaiLieBiao(@Query("token")String token, @Query("page")String page, @Query("size")String size);

    @POST("pengyou/replyDelete")
    Observable<BaseResponse<String>> replyDelete(@Query("token")String token, @Query("rid")String rid );//删除回复
    @POST("pengyou/detail")
    Observable<BaseResponse<DongTaiDetailBean>> dongtaiDetail(@Query("token")String token, @Query("pid")String pid,@Query("max_like")String maxLike,@Query("max_reply")String maxReply );//删除回复
    @POST("pengyou/getLike")
    Observable<BaseResponse<DongTaiListBean.DongTaiItem.ReplyList>> dianzanList(@Query("token")String token, @Query("pid")String pid,@Query("page")String page,@Query("size")String size );//删除回复
    @POST("pengyou/getReply")
    Observable<BaseResponse<DongTaiListBean.DongTaiItem.ReplyList>> huiFuList(@Query("token")String token, @Query("pid")String pid,@Query("page")String page,@Query("size")String size );//回复列表
    @POST("pengyou/idongtai")
    Observable<BaseResponse<List<MyDongTaiBean>>> getMyDongTaiList(@Query("token")String token, @Query("page")String page, @Query("size")String size);

}
